using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace OpenBlock
{
    public class Singleton<T> : MonoBehaviour where T : Singleton<T>
    {
        private static T _instance;
        public static T Instance { get => _instance; }
        public static T GetInstance() => _instance;
        protected virtual void Awake()
        {
            if (_instance != null && _instance != this)
            {
                Destroy(gameObject);
                return;
            }
            _instance = (T)this;
        }
    }
}
